package com.web.new12306.service.impl;

import java.sql.Connection;
import java.util.List;

import com.web.new12306.dao.TicketDao;
import com.web.new12306.dao.impl.TicketDaoImpl;
import com.web.new12306.pojo.Ticket;
import com.web.new12306.service.TicketService;
import com.web.new12306.util.DaoUtil;

public class TicketServiceImpl  implements TicketService {
	/**
	 * @author 赵靖懿
	 */

	@Override
	public List<Ticket> queryTickets(Integer pages,Integer rows) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		TicketDao  tdao = new TicketDaoImpl();
		List< Ticket> list=tdao.select(conn, pages, rows);
		return list;
	}

	@Override
	public int number() {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		TicketDao  tdao = new TicketDaoImpl();
		int number =tdao.number(conn);
		return number;
	}

	@Override
	public boolean updateTicket(Ticket t) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		TicketDao  tdao = new TicketDaoImpl();
		return tdao.updateTicket(conn,t);
	}

	/**
	 * @author 封梦琳
	 */
	public void insertTicket(Ticket t) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		TicketDao  tdao = new TicketDaoImpl();
		tdao.insertTicket(conn,t);
	}

	/**
	 * @author 封梦琳
	 */
	public boolean deleteTicket(Ticket t) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		TicketDao  tdao = new TicketDaoImpl();
		return tdao.deleteTicket(conn,t);
	}

	

}
